<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="powerType"/>
            <p:panel>
                <h:panelGrid id="pgCondition" columns="2" style="width: 100%">
                    <h:panelGrid>
                        <h:panelGrid columns="6">
                            <p:outputLabel value="所属种类：" for="powerType"/>
                            <p:selectOneMenu id="powerType" value="#{esInitPowerHisAction.flowCtrlHis.powerType}"
                                             style="width:133px">
                                <f:selectItems value="#{esCommon.itemTypeList}"/>
                                <p:ajax update="msgs,pgCondition"
                                        listener="#{esInitPowerHisAction.setEsInitPowerHisActionOfPowerPkidAction}"/>
                            </p:selectOneMenu>
                            <p:outputLabel id="strLabel1"
                                            value="#{esInitPowerHisAction.strLabel1}："
                                            for="tkcttCstpl"
                                            rendered="#{esInitPowerHisAction.strRendered1}"/>
                            <p:selectOneMenu id="tkcttCstpl"
                                             value="#{esInitPowerHisAction.strTkcttCstplSelected}"
                                             rendered="#{esInitPowerHisAction.strRendered1}">
                                <f:selectItems value="#{esInitPowerHisAction.esInitCtt1List}"/>
                                <p:ajax update="msgs,pgCondition"
                                        listener="#{esInitPowerHisAction.setFromTkAndCttToSStlAction}"/>
                            </p:selectOneMenu>
                            <p:outputLabel id="strLabel2"
                                           value="#{esInitPowerHisAction.strLabel2}："
                                           for="subcttStlTkcttMeaSta"
                                           rendered="#{esInitPowerHisAction.strRendered2}"/>
                            <p:selectOneMenu id="subcttStlTkcttMeaSta"
                                             value="#{esInitPowerHisAction.flowCtrlHis.powerPkid}"

                                             rendered="#{esInitPowerHisAction.strRendered2}">
                                <f:selectItems value="#{esInitPowerHisAction.esInitCtt2List}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>
                        <h:panelGrid columns="6">
                            <p:outputLabel value="期数编码：" for="pno"/>
                            <p:inputText id="pno" value="#{esInitPowerHisAction.flowCtrlHis.periodNo}"/>
                            <p:outputLabel value="状态标志：" for="sf"/>
                            <p:selectOneMenu id="sf" value="#{esInitPowerHisAction.flowCtrlHis.statusFlag}">
                                <f:selectItems value="#{esCommon.statusFlagList}"/>
                            </p:selectOneMenu>
                            <p:outputLabel value="状态原因：" for="preStatusFlag"/>
                            <p:selectOneMenu id="preStatusFlag" value="#{esInitPowerHisAction.flowCtrlHis.preStatusFlag}">
                                <f:selectItems value="#{esCommon.preStatusFlagList}"/>
                            </p:selectOneMenu>
                        </h:panelGrid>
                        <h:panelGrid columns="4">
                            <p:outputLabel value="创建人名：" for="createid"/>
                            <p:inputText id="createid" value="#{esInitPowerHisAction.flowCtrlHis.createdBy}"/>
                            <p:outputLabel value="创建时间：" for="createdate"/>
                            <p:inputText id="createdate" value="#{esInitPowerHisAction.flowCtrlHis.createdDate}"
                                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>
                        </h:panelGrid>
                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <h:panelGrid>
                            <p:commandButton id="qryBtn" value="查询"
                                             action="#{esInitPowerHisAction.onQueryAction('true')}"
                                             update="pdt,msgs">
                            </p:commandButton>
                            <p:commandButton id="resetBtn" value="重置"
                                             type="reset"
                                             update="pgCondition,msgs">
                            </p:commandButton>
                        </h:panelGrid>
                        <p:ajaxStatus style="width:16px;height:16px;">
                            <f:facet name="start">
                                <h:graphicImage value="/images/ajaxloading.gif"/>
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value=""/>
                            </f:facet>
                        </p:ajaxStatus>
                    </h:panelGrid>
                </h:panelGrid>
            </p:panel>
            <!--列表维护-->
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{esInitPowerHisAction.flowCtrlHisList}"
                         var="record"
                         rowKey="#{record.powerPkid}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowIndexVar="row"
                         rowsPerPageTemplate="500,200,100,45,30,15"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitTkcttList">
                <p:column headerText="序号" style="width:30px">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column headerText="pkid" style="display:none;" rendered="false">
                    <h:outputText id="tetid" value="#{record.powerPkid}"/>
                </p:column>
                <p:column headerText="对象所属" style="text-align:center">
                    <h:outputText value="#{esCommon.getLabelByValueInItemTypeList(record.powerType)}"/>
                </p:column>
                <p:column headerText="对象" style="text-align:left">
                    <h:outputText value="#{tkCttInfoAction.getCttInfoByPkId(record.powerPkid).name}"/>
                </p:column>
                <p:column headerText="期数编码" style="text-align:center">
                    <h:outputText value="#{record.periodNo}"/>
                </p:column>
                <p:column headerText="状态标志" style="text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>
                <p:column headerText="创建人" style="text-align:center">
                    <h:outputText value="#{esCommon.opersMap.get(record.createdBy)}"/>
                </p:column>
                <p:column headerText="创建时间" style="text-align:center">
                    <h:outputText value="#{record.createdDate}"/>
                </p:column>
                <p:column headerText="状态原因" style="text-align:center">
                    <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>
                <p:column headerText="备注內容" style="text-align:center">
                    <h:outputText value="#{record.spareField}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>